
<script type="text/javascript">
function restoreSharedLinks(order)
{
    $('#summary[order="' + order + '"]').html($('div[name="default"][link="shared_summary"][order="' + order + '"]').html());
    $('#domains[order="' + order + '"]').html($('div[name="default"][link="shared_domains"][order="' + order + '"]').html());
    $('#databases[order="' + order + '"]').html($('div[name="default"][link="shared_databases"][order="' + order + '"]').html());
    $('#ftp[order="' + order + '"]').html($('div[name="default"][link="shared_ftp"][order="' + order + '"]').html());
    $('#email[order="' + order + '"]').html($('div[name="default"][link="shared_email"][order="' + order + '"]').html());
    return false;
}

$(document).ready(function()
{
    var url = location.href;
    var str = url.replace(/^.*#/, '');
    string = str.split(/:/);
    var founded = []
    if (string[1])
    {
        shared_tabs = [];
        shared_tabs = string[1].split(/,/);
        for(var i in shared_tabs)
        {
            if (!shared_tabs.hasOwnProperty(i)) continue;
            tab = shared_tabs[i].split(/=/);
            //$('#' + tab[1] + '[order="' + tab[0] + '"]').addClass('current');
            $('#' + tab[1] + '[order="' + tab[0] + '"] a').trigger('click');
            $('#order_shared_choice[order="' + tab[0] + '"]').trigger('click');
            founded.push(tab[0]);
        }
    }
    {% for order in parameters.ordersShared %}
        has = false;
        for(var i=0; i<founded.length; i++) 
        {
            if (founded[i] == "{{ order.getUnixLogin() }}")
            {
                has = true;
                break;
            }
	}
        if (!has)
        {
            //$('#summary[order="' + "{{ order.getUnixLogin() }}" + '"]').addClass('current');
            //$('#summary[order="' + "{{ order.getUnixLogin() }}" + '"] a').trigger('click');
            
        }
    {% endfor %}
    if (founded.length == 0)
    {
        has = false;
        {% for order in parameters.ordersShared %}
            if (!has)
            {
                $('#order_shared_choice[order="' + "{{ order.getUnixLogin() }}" + '"]').trigger('click');
            }
            has = true;
        {% endfor %}
    }
});
</script>

<div class="span2">
        <div style="margin:27px 0 10px 0">
                <h5>Виртуальный хостинг</h5>
                <ul class="nav nav-pills nav-stacked" style="margin:10px 0; width:150px;">
                    {% for order in parameters.ordersShared %}
                        <li><a href="" id="order_shared_choice" order="{{ order.getUnixLogin() }}">{{ order.getUnixLogin() }}</a></li>
                    {% endfor %}
                </ul>
        </div>
        <div>
                <h5>Домены</h5>
                <ul class="nav nav-pills nav-stacked" style="margin:10px 0 0 0; width:150px;">
                    {% for domain in parameters.domains %}
                        <li><a href="" id="domain_choice" name="{{ domain.getName() }}">{{ domain.getName() }}</a></li>
                    {% endfor %}
                </ul>
        </div>
</div>
<div class="span10" id="shared_content">  
</div>

            {#{% for order in parameters.ordersShared %}
                <div name="default" link="shared_summary" order="{{ order.getUnixLogin() }}" style="display:none">
                    <div name="human_link" action="summary" order="{{ order.getUnixLogin() }}">
                        <a href="" order="{{ order.getUnixLogin() }}">Общая информация</a>
                    </div>
                </div>
                <div name="default" link="shared_domains" order="{{ order.getUnixLogin() }}" style="display:none">
                    <div name="human_link" action="domains" order="{{ order.getUnixLogin() }}">
                        <a href="" order="{{ order.getUnixLogin() }}">Домены</a>
                    </div>
                </div>
                <div name="default" link="shared_databases" order="{{ order.getUnixLogin() }}" style="display:none">
                    <div name="human_link" action="databases" order="{{ order.getUnixLogin() }}">
                        <a href="" order="{{ order.getUnixLogin() }}">Базы данных MySQL</a>
                    </div>
                </div>
                <div name="default" link="shared_ftp" order="{{ order.getUnixLogin() }}" style="display:none">
                    <div name="human_link" action="ftp" order="{{ order.getUnixLogin() }}">
                        <a href="" order="{{ order.getUnixLogin() }}">FTP</a>
                    </div>
                </div>
                <div name="default" link="shared_email" order="{{ order.getUnixLogin() }}" style="display:none">
                    <div name="human_link" action="email" order="{{ order.getUnixLogin() }}">
                        <a href="" order="{{ order.getUnixLogin() }}">Электронная почта</a>
                    </div>
                </div>
                <div id="ip" order="{{ order.getUnixLogin() }}">
                    <div name="human_link" action="ip" order="{{ order.getUnixLogin() }}" style="display:none">
                        <a href="" order="{{ order.getUnixLogin() }}">Управление ip</a>
                    </div>
                </div>
                <div id="add_domain_to_order" order="{{ order.getUnixLogin() }}">
                    <div name="human_link" action="add_domain_to_order" order="{{ order.getUnixLogin() }}" style="display:none">
                        <a href="" order="{{ order.getUnixLogin() }}">Добавить домен к заказу</a>
                    </div>
                </div>
                <div class="mainnav">
                        <div class="wrapper">
                                <table>
                                        <tr>
                                                <th>
                                                    <div id="summary" order="{{ order.getUnixLogin() }}">
                                                        <div name="human_link" action="summary" order="{{ order.getUnixLogin() }}">
                                                            <a href="" order="{{ order.getUnixLogin() }}">Общая информация</a>
                                                        </div>
                                                    </div>
                                                </th>
                                                <th>
                                                    <div id="domains" order="{{ order.getUnixLogin() }}">
                                                        <div name="human_link" action="domains" order="{{ order.getUnixLogin() }}">
                                                            <a href="" order="{{ order.getUnixLogin() }}">Домены</a>
                                                        </div>
                                                    </div>
                                                </th>
                                                <th>
                                                    <div id="databases" order="{{ order.getUnixLogin() }}">
                                                        <div name="human_link" action="databases" order="{{ order.getUnixLogin() }}">
                                                            <a href="" order="{{ order.getUnixLogin() }}">Базы данных MySQL</a>
                                                        </div>
                                                    </div>
                                                </th>
                                                <th>
                                                    <div id="ftp" order="{{ order.getUnixLogin() }}">
                                                        <div name="human_link" action="ftp" order="{{ order.getUnixLogin() }}">
                                                            <a href="" order="{{ order.getUnixLogin() }}">FTP</a>
                                                        </div>
                                                    </div>
                                                </th>
                                                <th>
                                                    <div id="email" order="{{ order.getUnixLogin() }}">
                                                        <div name="human_link" action="email" order="{{ order.getUnixLogin() }}">
                                                            <a href="" order="{{ order.getUnixLogin() }}">Электронная почта</a>
                                                        </div>
                                                    </div>
                                                </th>
                                        </tr>
                                </table>
                        </div>
                </div>
                <div id="content" order="{{ order.getUnixLogin() }}"></div>
                <div class="end"></div>
            {% endfor %}
            #}
<tr>  
    <td class="content">
            {% for order in parameters.ordersVps %}
                    <div class="wrapper">
                            <h1 class="ml">VPS: {{ order.getName() }}</h1>
                    </div>
                    <div class="wrapper">
                            <table>
                                    <tr>
                                            <td width="50%">
                                                    <h2 class="ml">Тариф {{ parameters.tarifs[order.getVpsTarif()]['name'] }}</h2>
                                                    <table class="vps-custom">
                                                            <tr>

                                                                    <td class="grey" width="40%">Процессор</td>
                                                                    <td>{{ order.getCpu() }} MГц
                                                                    <br>
                                                                    <a href="" class="action">добавить</a></td>
                                                            </tr>
                                                            <tr>
                                                                    <td class="grey">Дисковая система</td>
                                                                    <td>Основной диск — {{ order.getHdd() }}<script type="text/javascript">
                                                                                            //g = ({{ order.getHdd() }} / 1024).toFixed(3);
                                                                                            //document.write(g);
                                                                                        </script> Гб<br>
                                                                            /dev/xvda — 2 Гб <a href="" class="del">удалить</a><br>
                                                                            /dev/xvdb — 500 Мб <a href="" class="del">удалить</a><br>
                                                            <a href="" class="action">добавить диск</a></td>
                                                            </tr>
                                                            <tr>
                                                                    <td class="grey">Оперативная память</td>
                                                                    <td>{{ order.getRam() }} Мб
                                                                    <br>
                                                            <a href="" class="action">добавить память</a></td>
                                                            </tr>
                                                            <tr>
                                                                    <td class="grey">Стоимость дня, руб.</td>
                                                                    <td>{{ parameters.tarifs[order.getVpsTarif()]['cost'] }}</td>
                                                            </tr>

                                                    </table>
                                                    <a href="" class="action">Остановить</a> <a href="" class="del">Переустановить систему</a> &nbsp;&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;&nbsp;<a href="{{ url('orders_vps_extension', {'id': order.getId()} ) }}" class="action">Продлить</a><a href="{{ url('orders_vps_update', {'id': order.getId()} ) }}" class="action">Изменить тариф</a>
                                            </td>
                                            <td width="30%">
                                                    <h2>Домены</h2>
                                                    <div id="summary_domains" order_name="{{ order.getName() }}"></div>
                                                    <script type="text/javascript">
                                                    {% set i=1 %}
                                                    {% for key, domain in parameters.domains %}
                                                        if ({{key}} == {{ order.getId() }})
                                                        {
                                                            {% for d in parameters.domains[key] %}
                                                                $('#summary_domains[order_name="{{ order.getName() }}"]').append('{{ i }}. <a href="">{{ d['name'] }}</a><br>');
                                                                {% set i=i+1 %}
                                                            {% endfor %}
                                                        }
                                                    {% endfor %}
                                                    </script>
                                                    <br>
                                                    <a href="{{ url('domains_add_to_order', {'id': order.getId()} ) }}" class="action">Добавить домен</a>
                                            </td>
                                            <td>
                                                    <h2>Сетевые настройки</h2>

                                                    <table class="vps-custom">
                                                            <tr>
                                                                    <td class="grey">DNS</td>
                                                                    <td id="summary_dns" order_name="{{ order.getName() }}">
                                                                    <script type="text/javascript">
                                                                    {% for key, dns in parameters.dnss %}
                                                                        if ({{key}} == {{ order.getId() }})
                                                                        {
                                                                            {% for d in parameters.dnss[key] %}
                                                                                $('#summary_dns[order_name="{{ order.getName() }}"]').append('{{ d }}<br>');
                                                                            {% endfor %}
                                                                        }
                                                                    {% endfor %}
                                                                    </script>
                                                                    </td>
                                                            </tr>
                                                            <tr>
                                                                    <td class="grey">IP</td>
                                                                    <td id="summary_ip" order_name="{{ order.getName() }}">
                                                                    <script type="text/javascript">
                                                                    {% for key, ip in parameters.ips %}
                                                                        if ({{key}} == {{ order.getId() }})
                                                                        {
                                                                            {% for i in parameters.ips[key] %}
                                                                                $('#summary_ip[order_name="{{ order.getName() }}"]').append('{{ i }}<br>');
                                                                            {% endfor %}
                                                                        }
                                                                    {% endfor %}
                                                                    </script>
                                                                    </td>
                                                            </tr>
                                                            <tr>
                                                                    <td class="grey">Gateway</td>
                                                                    <td id="summary_gateway" order_name="{{ order.getName() }}">
                                                                    <script type="text/javascript">
                                                                    {% for key, gateway in parameters.gateways %}
                                                                        if ({{key}} == {{ order.getId() }})
                                                                        {
                                                                            {% for g in parameters.gateways[key] %}
                                                                                $('#summary_gateway[order_name="{{ order.getName() }}"]').append('{{ g }}<br>');
                                                                            {% endfor %}
                                                                        }
                                                                    {% endfor %}
                                                                    </script>
                                                                    </td>
                                                            </tr>

                                                    </table>
                                                    <a href="{{ url('orders_vps_add_ip', {'id': order.getId()} ) }}" class="action">Добавить IP-адрес</a>
                                            </td>
                                     </tr>
                             </table>
                    </div>
                    <div class="end"></div>
        {% endfor %}
    </td>
</tr>